package 链接snappydate数据库相关操作.snappydateDDL相关操作
import com.google.common.base.Throwables
import com.typesafe.config.{Config, ConfigFactory}
import java.sql.{Connection, DatabaseMetaData, DriverManager, ResultSet, Statement, Timestamp}
import org.apache.log4j.Logger
import org.apache.spark.sql.{DataFrame, SnappyJobInvalid, SnappyJobValid, SnappyJobValidation, SnappySQLJob, SnappySession}
import scala.collection.mutable

object MonitoringTableStructure extends SnappySQLJob {
  var connection: Connection = _
  var statement: Statement = _
  var sc: SnappySession = _
  var config: Config = _
  val log:Logger=Logger.getLogger("Structure_change_ of_detection_table1.0")
  def readTable(snappySession: SnappySession, props: mutable.HashMap[String, String]): DataFrame = {
    try {
      val readDF = snappySession.read.format("jdbc").options(props).load()
      readDF
    } catch {
      case ex: Exception =>
        log.warn(s"Exception thrown in read method:${Throwables.getStackTraceAsString(ex)}")
        throw ex
    }
  }

  override def isValidJob(sc: SnappySession, config: Config): SnappyJobValidation = {
    SnappyJobValid()
  }
  /**
   * Entry point for the snappyjob validate the mandatory parameters
   * @param sc snappysession
   * @param jobConfig config
   * @return
   */
  override def runSnappyJob(sc: SnappySession, jobConfig: Config): Any = {
    //ATSN PROD
    val cursor = new Create_Cursor()
    cursor.create_table()
    val date=new DatabaseDDL()
    date.select_table_struct()
    val delete = new Query_Delete()
    delete.query_delete_table()
    println("over!!!!")
  }

  def main(args: Array[String]): Unit = {
    //    connect(appName:String,port:String,url:String,master:String):
    SnappySessionHelper.connect("localhost:8090")
    runSnappyJob(SnappySessionHelper.snappySession,config)
  }




}
class MonitoringTableStructure{

}
